package algorithm.sort;

/**
 * @ Author     ：wangyw
 * @ Date       ：Created in 下午6:03 2021/11/2
 * @ Description：排序工具类
 */
public class SortUtils {

    public static <T> void swap(T[] arr, int x, int y) {
        T t = arr[x];
        arr[x] = arr[y];
        arr[y] = t;
    }

    public static Integer[] getRandomIntArr(int maxLen, int maxVal) {
        int len = (int) (Math.random() * maxLen) + 1;
        Integer[] ans = new Integer[len];
        for (int i = 0; i < len; i++) {
            ans[i] = (int) (Math.random() * (maxVal + 1))
                    - (int) (Math.random() * (maxVal + 1));
        }
        return ans;
    }
}
